package com.cs.peanut.base_app;

import android.os.Parcel;
import android.os.Parcelable;

public class Device implements Parcelable {
    private String ip;
    private String deviceName;
    private String deviceVersion;
    private String appVersion;

    private boolean power;
    private boolean screen;
    private float bright;
    private int color;
    private float voice;

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    public String getDeviceVersion() {
        return deviceVersion;
    }

    public void setDeviceVersion(String deviceVersion) {
        this.deviceVersion = deviceVersion;
    }

    public String getAppVersion() {
        return appVersion;
    }

    public void setAppVersion(String appVersion) {
        this.appVersion = appVersion;
    }

    public boolean isPower() {
        return power;
    }

    public void setPower(boolean power) {
        this.power = power;
    }

    public boolean isScreen() {
        return screen;
    }

    public void setScreen(boolean screen) {
        this.screen = screen;
    }

    public float getBright() {
        return bright;
    }

    public void setBright(float bright) {
        this.bright = bright;
    }

    public int getColor() {
        return color;
    }

    public void setColor(int color) {
        this.color = color;
    }

    public float getVoice() {
        return voice;
    }

    public void setVoice(float voice) {
        this.voice = voice;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.ip);
        dest.writeString(this.deviceName);
        dest.writeString(this.deviceVersion);
        dest.writeString(this.appVersion);
        dest.writeByte(this.power ? (byte) 1 : (byte) 0);
        dest.writeByte(this.screen ? (byte) 1 : (byte) 0);
        dest.writeFloat(this.bright);
        dest.writeInt(this.color);
        dest.writeFloat(this.voice);
    }

    public Device() {
    }

    protected Device(Parcel in) {
        this.ip = in.readString();
        this.deviceName = in.readString();
        this.deviceVersion = in.readString();
        this.appVersion = in.readString();
        this.power = in.readByte() != 0;
        this.screen = in.readByte() != 0;
        this.bright = in.readFloat();
        this.color = in.readInt();
        this.voice = in.readFloat();
    }

    public static final Creator<Device> CREATOR = new Creator<Device>() {
        @Override
        public Device createFromParcel(Parcel source) {
            return new Device(source);
        }

        @Override
        public Device[] newArray(int size) {
            return new Device[size];
        }
    };
}
